package com.sfdk.core
{
import com.sfdk.log.Logger;

import flash.utils.Dictionary;

public class DataStore
	{
		private static var _storage : Dictionary;
		
		public function DataStore()
		{
			if(_storage == null)
				_storage = new Dictionary();
			else
				Logger.error("Data Store :: Data Store cannot be instantiated twice");
		}
		
		public static function store(key : String, data : Object) : void
		{
			if (_storage[key] == null)
                _storage[key] = data;
            else
                Logger.debug("Data Store :: There was already a value for key " + key + " it has been replaced");
				
		}
		
		public static function get(key : String) : Object
		{
			if(_storage[key] != null)
				return _storage[key];
			else
			{
				Logger.log("Data Store :: There was no value for key "+ key);
				return null;
			}	
		}

	}
}